"""
一些基础配置
"""

class Config:
    def __init__(self, eth_provider, ipfs_host, ipfs_port, learning_rate, batch_size, min_members, dataset_path, 
                 dataset_yaml_path, enable_detector, detector_protocol, detector_host, detector_port, max_round_of_FL):
        self.ETHEREUM_HTTP_PROVIDER = eth_provider
        self.IPFS_HOST = ipfs_host
        self.IPFS_PORT = ipfs_port
        self.LEARNING_RATE = learning_rate
        self.BATCH_SIZE = batch_size
        self.MIN_MEMBERS = min_members
        self.DATASET_PATH = dataset_path
        self.DATASET_YAML_PATH = dataset_yaml_path
        self.ENABLE_DETECTOR = enable_detector
        self.DETECTOR_PROTOCOL = detector_protocol
        self.DETECTOR_HOST = detector_host
        self.DETECTOR_PORT = detector_port
        self.MAX_ROUND_OF_FL = max_round_of_FL
        self.LISTEN_PORT = 12345
        self.LISTEN_HOST = '0.0.0.0'


    def set_values(self, eth_provider, ipfs_host, ipfs_port, learning_rate, batch_size, min_members, dataset_path,
                   dataset_yaml_path, enable_detector, detector_protocol, detector_host, detector_port, max_round_of_FL):
        self.ETHEREUM_HTTP_PROVIDER = eth_provider
        self.IPFS_HOST = ipfs_host
        self.IPFS_PORT = ipfs_port
        self.LEARNING_RATE = learning_rate
        self.BATCH_SIZE = batch_size
        self.MIN_MEMBERS = min_members
        self.DATASET_PATH = dataset_path
        self.DATASET_YAML_PATH = dataset_yaml_path
        self.ENABLE_DETECTOR = enable_detector
        self.DETECTOR_PROTOCOL = detector_protocol
        self.DETECTOR_HOST = detector_host
        self.DETECTOR_PORT = detector_port
        self.MAX_ROUND_OF_FL = max_round_of_FL

